package cn.weekimwee.firstlineofcodeforkotlin.unit2

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.util.Log
import cn.weekimwee.firstlineofcodeforkotlin.BaseActivity
import cn.weekimwee.firstlineofcodeforkotlin.R
import kotlinx.android.synthetic.main.activity_second.*

class SecondActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)
        text.text = intent.getStringExtra("second")
        Log.e("SecondActivity","s taskId ->$taskId")
        button_2.setOnClickListener {
            thisFinish()
        }
    }

    override fun onBackPressed() {
        thisFinish()
    }

    private fun thisFinish(){
        setResult(Activity.RESULT_OK, Intent().putExtra("return_data","hello first"))
        finish()
    }
}
